--
-- PostgreSQL database dump
--

-- Dumped from database version 9.0.4
-- Dumped by pg_dump version 9.0.4
-- Started on 2011-11-15 21:04:44

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 319 (class 2612 OID 11574)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1516 (class 1259 OID 16424)
-- Dependencies: 1799 5
-- Name: Affiliate; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE "Affiliate" (
    id integer NOT NULL,
    url character varying(255) NOT NULL,
    email character varying(255) NOT NULL,
    token character varying(255) NOT NULL,
    is_active boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone NOT NULL
);


ALTER TABLE public."Affiliate" OWNER TO postgres;

--
-- TOC entry 1515 (class 1259 OID 16422)
-- Dependencies: 1516 5
-- Name: Affiliate_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE "Affiliate_id_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public."Affiliate_id_seq" OWNER TO postgres;

--
-- TOC entry 1824 (class 0 OID 0)
-- Dependencies: 1515
-- Name: Affiliate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE "Affiliate_id_seq" OWNED BY "Affiliate".id;


--
-- TOC entry 1825 (class 0 OID 0)
-- Dependencies: 1515
-- Name: Affiliate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('"Affiliate_id_seq"', 1, false);


--
-- TOC entry 1514 (class 1259 OID 16408)
-- Dependencies: 5
-- Name: Category; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE "Category" (
    id integer NOT NULL,
    name character varying(255) NOT NULL
);


ALTER TABLE public."Category" OWNER TO postgres;

--
-- TOC entry 1518 (class 1259 OID 16436)
-- Dependencies: 5
-- Name: Category_Affiliate; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE "Category_Affiliate" (
    id integer NOT NULL,
    affiliate_id integer NOT NULL
);


ALTER TABLE public."Category_Affiliate" OWNER TO postgres;

--
-- TOC entry 1517 (class 1259 OID 16434)
-- Dependencies: 5 1518
-- Name: Category_Affiliate_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE "Category_Affiliate_id_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public."Category_Affiliate_id_seq" OWNER TO postgres;

--
-- TOC entry 1826 (class 0 OID 0)
-- Dependencies: 1517
-- Name: Category_Affiliate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE "Category_Affiliate_id_seq" OWNED BY "Category_Affiliate".id;


--
-- TOC entry 1827 (class 0 OID 0)
-- Dependencies: 1517
-- Name: Category_Affiliate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('"Category_Affiliate_id_seq"', 1, false);


--
-- TOC entry 1513 (class 1259 OID 16406)
-- Dependencies: 5 1514
-- Name: Category_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE "Category_id_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public."Category_id_seq" OWNER TO postgres;

--
-- TOC entry 1828 (class 0 OID 0)
-- Dependencies: 1513
-- Name: Category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE "Category_id_seq" OWNED BY "Category".id;


--
-- TOC entry 1829 (class 0 OID 0)
-- Dependencies: 1513
-- Name: Category_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('"Category_id_seq"', 1, false);


--
-- TOC entry 1512 (class 1259 OID 16395)
-- Dependencies: 5
-- Name: Job; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE "Job" (
    id integer NOT NULL,
    category_id integer NOT NULL,
    type character varying(255),
    company character varying(255) NOT NULL,
    logo character varying,
    url character varying(255),
    "position" character varying(255) NOT NULL,
    location character varying(255) NOT NULL,
    description text NOT NULL,
    how_to_apply text NOT NULL,
    token character varying(255) NOT NULL,
    is_public boolean NOT NULL,
    email character varying(255) NOT NULL,
    is_activated boolean,
    expires_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL
);


ALTER TABLE public."Job" OWNER TO postgres;

--
-- TOC entry 1511 (class 1259 OID 16393)
-- Dependencies: 1512 5
-- Name: Job_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE "Job_id_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public."Job_id_seq" OWNER TO postgres;

--
-- TOC entry 1830 (class 0 OID 0)
-- Dependencies: 1511
-- Name: Job_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE "Job_id_seq" OWNED BY "Job".id;


--
-- TOC entry 1831 (class 0 OID 0)
-- Dependencies: 1511
-- Name: Job_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('"Job_id_seq"', 1, false);


--
-- TOC entry 1798 (class 2604 OID 16427)
-- Dependencies: 1515 1516 1516
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE "Affiliate" ALTER COLUMN id SET DEFAULT nextval('"Affiliate_id_seq"'::regclass);


--
-- TOC entry 1797 (class 2604 OID 16411)
-- Dependencies: 1513 1514 1514
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE "Category" ALTER COLUMN id SET DEFAULT nextval('"Category_id_seq"'::regclass);


--
-- TOC entry 1796 (class 2604 OID 16398)
-- Dependencies: 1511 1512 1512
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE "Job" ALTER COLUMN id SET DEFAULT nextval('"Job_id_seq"'::regclass);


--
-- TOC entry 1817 (class 0 OID 16424)
-- Dependencies: 1516
-- Data for Name: Affiliate; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY "Affiliate" (id, url, email, token, is_active, created_at) FROM stdin;
\.


--
-- TOC entry 1816 (class 0 OID 16408)
-- Dependencies: 1514
-- Data for Name: Category; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY "Category" (id, name) FROM stdin;
\.


--
-- TOC entry 1818 (class 0 OID 16436)
-- Dependencies: 1518
-- Data for Name: Category_Affiliate; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY "Category_Affiliate" (id, affiliate_id) FROM stdin;
\.


--
-- TOC entry 1815 (class 0 OID 16395)
-- Dependencies: 1512
-- Data for Name: Job; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY "Job" (id, category_id, type, company, logo, url, "position", location, description, how_to_apply, token, is_public, email, is_activated, expires_at, created_at, updated_at) FROM stdin;
\.


--
-- TOC entry 1801 (class 2606 OID 16403)
-- Dependencies: 1512 1512
-- Name: Job_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY "Job"
    ADD CONSTRAINT "Job_pkey" PRIMARY KEY (id);


--
-- TOC entry 1803 (class 2606 OID 16405)
-- Dependencies: 1512 1512
-- Name: Job_token_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY "Job"
    ADD CONSTRAINT "Job_token_key" UNIQUE (token);


--
-- TOC entry 1810 (class 2606 OID 16432)
-- Dependencies: 1516 1516
-- Name: i; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY "Affiliate"
    ADD CONSTRAINT i PRIMARY KEY (id);


--
-- TOC entry 1806 (class 2606 OID 16413)
-- Dependencies: 1514 1514
-- Name: id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY "Category"
    ADD CONSTRAINT id PRIMARY KEY (id);


--
-- TOC entry 1808 (class 2606 OID 16415)
-- Dependencies: 1514 1514
-- Name: name_unique; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY "Category"
    ADD CONSTRAINT name_unique UNIQUE (name);


--
-- TOC entry 1811 (class 1259 OID 16455)
-- Dependencies: 1518
-- Name: fki_aff; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_aff ON "Category_Affiliate" USING btree (affiliate_id);


--
-- TOC entry 1804 (class 1259 OID 16421)
-- Dependencies: 1512
-- Name: fki_category; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_category ON "Job" USING btree (category_id);


--
-- TOC entry 1814 (class 2606 OID 16450)
-- Dependencies: 1809 1518 1516
-- Name: aff; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY "Category_Affiliate"
    ADD CONSTRAINT aff FOREIGN KEY (affiliate_id) REFERENCES "Affiliate"(id) ON DELETE CASCADE;


--
-- TOC entry 1812 (class 2606 OID 16416)
-- Dependencies: 1805 1514 1512
-- Name: fk_category; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY "Job"
    ADD CONSTRAINT fk_category FOREIGN KEY (category_id) REFERENCES "Category"(id);


--
-- TOC entry 1813 (class 2606 OID 16440)
-- Dependencies: 1518 1805 1514
-- Name: id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY "Category_Affiliate"
    ADD CONSTRAINT id FOREIGN KEY (id) REFERENCES "Category"(id) ON DELETE CASCADE;


--
-- TOC entry 1823 (class 0 OID 0)
-- Dependencies: 5
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-11-15 21:04:46

--
-- PostgreSQL database dump complete
--

